package cn.zwx.common.xxl.job;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author zhangwenxue
 */
@ConfigurationProperties(prefix = "cn.zwx.job")
public class ZwxXxlJobProperties {

    /**
     *  连接地址
     **/
    private XxlJobAdmin xxlJobAdmin;

    /**
     *  执行器通讯TOKEN，非空时启用
     **/
    private String accessToken;

    /**
     * xxlJobExecutor
     */
    private XxlJobExecutorConf xxlJobExecutor;

    public XxlJobAdmin getXxlJobAdmin() {
        return xxlJobAdmin;
    }

    public void setXxlJobAdmin(XxlJobAdmin xxlJobAdmin) {
        this.xxlJobAdmin = xxlJobAdmin;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public XxlJobExecutorConf getXxlJobExecutor() {
        return xxlJobExecutor;
    }

    public void setXxlJobExecutor(XxlJobExecutorConf xxlJobExecutor) {
        this.xxlJobExecutor = xxlJobExecutor;
    }



    public static final  class XxlJobAdmin{
        /**
         *  address：执行器"AppName"和地址信息配置：
         **/
        private String addresses;

        public String getAddresses() {
            return addresses;
        }

        public void setAddresses(String addresses) {
            this.addresses = addresses;
        }
    }

    public static final class XxlJobExecutorConf{
        /**
         *  AppName执行器心跳注册分组依据；地址信息用于"调度中心请求并触发任务"和"执行器注册"。
         **/
        private String appName;
        /**
         * 注册地址
         */
        private String address;

        /**
         *  多网卡时可手动设置指定IP，手动设置IP时将会绑定Host。单机部署多个执行器时，注意要配置不同执行器端口；
         **/
        private String ip;

        /**
         *  执行器默认端口为9999，执行器IP默认为空表示自动获取IP
         **/
        private String port;

        /**
         *  日志地址
         **/
        private String logPath;

        /**
         *  执行器Log文件定期清理功能，指定日志保存天数，日志文件过期自动删除。限制至少保持3天，否则功能不生效；
         **/
        private String logRetentionDays;

        public String getAppName() {
            return appName;
        }

        public void setAppName(String appName) {
            this.appName = appName;
        }

        public String getAddress() {
            return address;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public String getIp() {
            return ip;
        }

        public void setIp(String ip) {
            this.ip = ip;
        }

        public String getPort() {
            return port;
        }

        public void setPort(String port) {
            this.port = port;
        }

        public String getLogPath() {
            return logPath;
        }

        public void setLogPath(String logPath) {
            this.logPath = logPath;
        }

        public String getLogRetentionDays() {
            return logRetentionDays;
        }

        public void setLogRetentionDays(String logRetentionDays) {
            this.logRetentionDays = logRetentionDays;
        }
    }

}
